home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / sbin / cryptdisks_start < prev    next >
Text File  |  2009-10-14  |  942b  |  45 lines

  1. #!/bin/sh
  2.  
  3. # cryptdisks_start - wrapper around cryptsetup which parses
  4. # /etc/crypttab, just like mount parses /etc/fstab.
  5.  
  6. # Initial code and (c) 2007 Jon Dowland <jon@alcopop.org>
  7. # License: GNU General Public License, v2 or any later
  8. # (http://www.gnu.org/copyleft/gpl.html)
  9.  
  10. set -e
  11.  
  12. if [ $# -lt 1 ]; then
  13.     echo "usage: $0 <name>" >&2
  14.     echo >&2
  15.     echo "reads /etc/crypttab and starts the mapping corresponding to <name>" >&2
  16.     exit 1
  17. fi
  18.  
  19. if [ -r /lib/cryptsetup/cryptdisks.functions ]; then
  20.     . /lib/cryptsetup/cryptdisks.functions
  21. else
  22.     exit 0
  23. fi
  24.  
  25. LOUD="yes"
  26.  
  27. log_action_begin_msg "Starting crypto disk"
  28. mount_fs
  29.  
  30. found="no"
  31. egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
  32.     if [ "$1" = "$dst" ]; then
  33.         found="yes"
  34.         handle_crypttab_line_start "$dst" "$src" "$key" "$opts" <&3
  35.         exit 0
  36.     fi
  37. done 3<&1
  38.  
  39. if [ "$found" = "no" ]; then
  40.     device_msg "$1" "failed, not found in crypttab"
  41. fi
  42.  
  43. umount_fs
  44. log_action_end_msg 0
  45.